
	function readCert()
	{
		clearForm();
		
		var CertCtl = document.getElementById("CertCtl");
	
		try 
		{
			var startDt = new Date();
			var result = CertCtl.ReadCard();
			var endDt = new Date();
	
			document.getElementById("timeElapsed").value = (endDt.getTime() - startDt.getTime()) + "毫秒";
			if(result == "")
			    document.getElementById("result").value = "读卡成功";
			else
			    document.getElementById("result").value = result;
	
			if (result == "")
			{	
			    document.getElementById("partyName").value = CertCtl.Name;
			    document.getElementById("gender").value = CertCtl.Sex;
			    document.getElementById("nation").value = CertCtl.Nation;
			    document.getElementById("bornDay").value = CertCtl.Born;
			    document.getElementById("certAddress").value = CertCtl.Address;
			    document.getElementById("certNumber").value = CertCtl.CardNo;
			    document.getElementById("certOrg").value = CertCtl.IssuedAt;
			    document.getElementById("effDate").value = CertCtl.EffectedDate;
			    document.getElementById("expDate").value = CertCtl.ExpiredDate;
			    document.getElementById("samID").value = CertCtl.CardReaderId;
			    document.getElementById("headPath").value = CertCtl.CardPicPath;
			    document.getElementById("headBase64Data").value = CertCtl.CardPictureData;
			    document.getElementById("headBase64DataLen").value = CertCtl.CardPictureDataLen;
			    document.getElementById("dispHead").src = 'data:image/jpeg;base64,' + CertCtl.CardPictureData;
			    var varHavePF = CertCtl.bHavePF;
			    if(varHavePF == true)
			        document.getElementById("hasFinger").value = "有指纹信息";
			    else
			        document.getElementById("hasFinger").value = "无指纹信息";
			}
	    } catch (e)
		{
		}
	}
	
	//身份证读卡器调取		
	function getVerSion()
	{
		clearForm();
	}
	
	function clearForm()
	{
	    document.getElementById("timeElapsed").value = "";
	    document.getElementById("samID").value = "";
		document.getElementById("partyName").value = "";
		document.getElementById("gender").value = "";
		document.getElementById("nation").value = "";
		document.getElementById("bornDay").value = "";
		document.getElementById("certAddress").value = "";
		document.getElementById("certNumber").value = "";
		document.getElementById("certOrg").value = "";
		document.getElementById("effDate").value = "";
		document.getElementById("expDate").value = "";
		document.getElementById("result").value = "";
		document.getElementById("headPath").value = "";
		document.getElementById("hasFinger").value = "";
		document.getElementById("headBase64Data").value = "";
		document.getElementById("headBase64DataLen").value = "";
		document.getElementById("dispHead").src = "";
	/* 	document.getElementById("finPath1").value = "c:\\finger1.bmp";
		document.getElementById("finPath2").value = "c:\\finger2.bmp";
		document.getElementById("firstFinData").value = "";
		document.getElementById("secondFinData").value = "";
		document.getElementById("firstFinImg").src = "";
		document.getElementById("secondFinImg").src = ""; */
	
		var CertCtl = document.getElementById("CertCtl");
		CertCtl.ClearData(3); // 1为控件缓存的读卡数据，2为缓存的指纹数据，3为所有缓存数据
	}
	function connect()
	{
		clearForm();
		
		var CertCtl = document.getElementById("CertCtl");
		try 
		{
		    var result = CertCtl.OpenComm();
		    if (result == ""){
		        document.getElementById("result").value = "连接成功";
		     //   alert("连接成功");
		   } else{
			    document.getElementById("result").value = result;
			    }
	    } catch (e) 
		{
		}
	}
	function disconnect()
	{
		clearForm();
	
		var CertCtl = document.getElementById("CertCtl");
		try
		{
		    var result = CertCtl.CloseComm();
		    if (result == "")
		        document.getElementById("result").value = "断开成功";
		    else
		        document.getElementById("result").value = result;
		} catch (e)
		{
		}
	}
	/* 
	function compareFirstFinger()
	{
	    var CertCtl = document.getElementById("CertCtl");
	    var varHavePF = CertCtl.bHavePF;
	    if (document.getElementById("firstFinData").value == "")
	    {
	        alert("第一枚指纹尚未采集");
	        return;
	    }
	    if (varHavePF == false)
	    {
	        alert("没有指纹信息");
	        return;
	    }
	
	    var result = CertCtl.MatchFPF();
	    if (result == "")
	    {
	        var similar = CertCtl.FSimilar;
	        document.getElementById("result").value = "对比第一枚指纹成功，相似度为：" + similar;
	    }
	    else
	    {
	        document.getElementById("result").value = result;
	    }
	}
	
	function compareSecondFinger()
	{
	    var CertCtl = document.getElementById("CertCtl");
	    var varHavePF = CertCtl.bHavePF;
	
	    if (document.getElementById("secondFinData").value == "")
	    {
	        alert("第一枚指纹尚未采集");
	        return;
	    }
	    if (varHavePF == false)
	    {
	        alert("没有指纹信息");
	        return;
	    }
	
	    var result = CertCtl.SSimilar();
	    if (result == "")
	    {
	        var similar = CertCtl.SSimilar;
	        document.getElementById("result").value = "对比第二枚指纹成功，相似度为：" + similar;
	    }
	    else
	    {
	        document.getElementById("result").value = result;
	    }
	}
	
	function scanFirstFinger()
	{
	    var CertCtl = document.getElementById("CertCtl");
	    var filePath = document.getElementById("finPath1").value;
	    if (filePath == "")
	    {
	        alert("请输入保存路径");
	        return;
	    }
	    var result = CertCtl.ScanFirstFinger(filePath);
	    if (result == "")
	    {
	        document.getElementById("result").value = "采集成功";
	        document.getElementById("firstFinData").value = CertCtl.PictureFFPData;
	        document.getElementById("firstFinImg").src = 'data:image/bmp;base64,' + CertCtl.PictureFFPData;
	    }
	    else
	        document.getElementById("result").value = result;
	}
	function scanSecondFinger()
	{
	    var CertCtl = document.getElementById("CertCtl");
	    var filePath = document.getElementById("finPath2").value;
	    if (filePath == "")
	    {
	        alert("请输入保存路径");
	        return;
	    }
	    var result = CertCtl.ScanSecondFinger(filePath);
	    if (result == "")
	    {
	        document.getElementById("result").value = "采集成功";
	        document.getElementById("secondFinData").value = CertCtl.PictureSPFData;
	        document.getElementById("secondFinImg").src = 'data:image/bmp;base64,' + CertCtl.PictureSPFData;
	    }
	    else
	        document.getElementById("result").value = result;
	} */
